<template>
  <div>
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix relative">
        <span class="title-icon" style="float:left;"
          >方案 {{ onlineInquiryReplyData.index }}
          <template v-if="onlineInquiryReplyData.waybillNos">
            <span
              v-for="(item, index) in onlineInquiryReplyData.waybillNos.split(
                ','
              )"
              :key="index"
              style="margin-left: 20px;"
            >
              <a
                :href="`/#/blank/waybill__alledit__main?waybillNo=${item}`"
                target="_blank"
                >{{ item }}</a
              >
            </span>
          </template>
        </span>
      </div>
      <el-form
        ref="onlineInquiryReplyForm"
        :model="onlineInquiryReplyData"
        :rules="onlineInquiryReplyRules"
        size="mini"
        label-width="90px"
      >
        <el-form-item label="是否可接" prop="isAccept">
          <el-radio-group
            v-model="onlineInquiryReplyData.isAccept"
            size="medium"
          >
            <el-radio
              v-for="(item, value) in isAcceptOptions"
              :key="value"
              :label="item.value"
              >{{ item.label }}</el-radio
            >
          </el-radio-group>
        </el-form-item>
        <template v-if="onlineInquiryReplyData.isAccept == 1">
          <el-form-item
            label="回复渠道"
            prop="channelId"
            v-if="
              onlineInquirySheetSimpleData.onlineInquiryShippingWay == 1 ||
                onlineInquirySheetSimpleData.onlineInquiryShippingWay == 4
            "
          >
            <el-select
              v-model="onlineInquiryReplyData.channelId"
              placeholder="请选择回复渠道"
              clearable
              filterable
              :style="{ width: '100%' }"
              @change="selectLetterClick"
            >
              <el-option
                v-for="(item, value) in channelNameMap"
                :key="value"
                :label="item"
                :value="parseInt(value)"
              ></el-option>
            </el-select>
            <template v-if="onlineInquiryReplyData.channelId != null">
              <el-button type="danger" @click="dialogTableVisibleClick"
                >查看对外卖价</el-button
              >
            </template>
          </el-form-item>
          <el-row>
            <el-col :span="12">
              <el-form-item label="建议卖价" prop="suggestPrice">
                <el-input
                  v-model="onlineInquiryReplyData.suggestPrice"
                  placeholder="请输入建议卖价"
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="有效期" prop="validityDate">
                <el-date-picker
                  v-model="onlineInquiryReplyData.validityDate"
                  :picker-options="pickerBeginDateBefore"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  :style="{ width: '100%' }"
                  placeholder="请选择有效期"
                  clearable
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="预计离港" prop="predictLeavePortDate">
                <el-date-picker
                  v-model="onlineInquiryReplyData.predictLeavePortDate"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  :style="{ width: '100%' }"
                  placeholder="请选择预计离港"
                  clearable
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="预计到港" prop="predictArrivalPortDate">
                <el-date-picker
                  v-model="onlineInquiryReplyData.predictArrivalPortDate"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  :style="{ width: '100%' }"
                  placeholder="请选择预计到港"
                  clearable
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
        </template>
        <el-form-item label="回复备注" prop="remark">
          <el-input
            v-model="onlineInquiryReplyData.remark"
            type="textarea"
            placeholder="请输入回复备注"
            :autosize="{ minRows: 2, maxRows: 2 }"
            :style="{ width: '100%' }"
          ></el-input>
        </el-form-item>
        <el-form-item label="操作备注" prop="operateRemark">
          <el-input
            v-model="onlineInquiryReplyData.operateRemark"
            type="textarea"
            placeholder="请输入操作备注"
            :autosize="{ minRows: 2, maxRows: 2 }"
            :style="{ width: '100%' }"
          ></el-input>
        </el-form-item>
        <template v-if="onlineInquiryReplyData.isAccept == 1">
          <el-form-item
            label="报价表是否按照附加费收取"
            prop="isQuotationList"
            label-width="185px"
          >
            <el-radio-group
              v-model="onlineInquiryReplyData.isQuotationList"
              size="medium"
            >
              <el-radio
                v-for="(item, value) in isQuotationListOptions"
                :key="value"
                :label="item.value"
                >{{ item.label }}</el-radio
              >
            </el-radio-group>
          </el-form-item>
          <el-divider></el-divider>
          <p style="margin-bottom:20px;">
            <span style="font-weight:bold;font-size:14px;padding:0 28px;"
              >费用明细</span
            >实重：{{ onlineInquirySheetSimpleData.customerActualWeight }} KG
            ,体积: {{ onlineInquirySheetSimpleData.customerVolume }} CBM
            ,计费重：{{ onlineInquirySheetSimpleData.chargeWeight }}
            KG （167:1，不适用于海运以体积结算的产品）
          </p>
          <el-table
            :data="onlineInquiryReplyData.onlineInquiryCosts"
            size="mini"
            :show-header="false"
            style="width: 90%;margin:0 auto;"
          >
            <el-table-column prop="amoebaSubjectId" label="阿米巴科目名称">
              <template slot-scope="scope">
                {{ amoebaSubjectMap[scope.row["amoebaSubjectId"]] }}
              </template>
            </el-table-column>
            <el-table-column prop="unitPrice" label="单价">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['unitPrice']"
                  clearable
                  size="mini"
                  onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
                  @input="changeAmoebaSubjectMoney"
                />
                <!-- <el-input-number
                  v-model="scope.row['unitPrice']"
                  size="mini"
                  :precision="2"
                  :controls="false"
                ></el-input-number> -->
              </template>
            </el-table-column>
            <el-table-column label="X" width="30">
              <span>X</span>
            </el-table-column>
            <el-table-column prop="calculationMode" label="计费方式">
              <template slot-scope="scope">
                <el-select
                  v-model="scope.row['calculationMode']"
                  size="mini"
                  @change="changeAmoebaSubjectMoney"
                >
                  <el-option
                    v-for="(item, value) in chargingTypeMap"
                    :key="value"
                    :label="item"
                    :value="parseInt(value)"
                  ></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="=" width="30">
              <span>=</span>
            </el-table-column>
            <el-table-column prop="money" label="金额">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['money']"
                  clearable
                  size="mini"
                  :readonly="true"
                />
              </template>
            </el-table-column>
          </el-table>
          <p class="p_ms">
            合计：{{ onlineInquiryReplyData.totalOnlineInquiryCost }} 元
          </p>
          <p class="p_ms">
            内部平均价格：{{ onlineInquiryReplyData.avgOnlineInquiryCost }}
            {{ onlineInquiryReplyData.costUnit }}
          </p>
          <p class="p_ms" v-if="onlineInquiryReplyData.inquiryPrice">
            对外卖价：{{ onlineInquiryReplyData.inquiryPrice }}
            {{ onlineInquiryReplyData.currency }}
          </p>
          <p class="p_ms" style="color:red">
            {{ messageStr }}
          </p>
          <p class="p_ms" style="color:red">
            入库数据不及渠道最小运单计费量，将按实际最小运单计费量计费
          </p>
        </template>

        <el-form-item style="float:right;">
          <el-button-group>
            <el-button
              type="default"
              @click="deleteRepy"
              v-if="
                onlineInquiryReplyData.index > 1 &&
                  !justAddOneReply &&
                  !justShowOnlineSheet
              "
              >删除方案</el-button
            >
            <el-button
              type="default"
              @click="copyRepy"
              v-show="
                totalReplySize < 3 && !justAddOneReply && !justShowOnlineSheet
              "
              >复制方案</el-button
            >
            <el-button
              type="default"
              @click="addEnptyRepy"
              v-show="
                totalReplySize < 3 && !justAddOneReply && !justShowOnlineSheet
              "
              >添加方案</el-button
            >
            <el-button
              type="primary"
              @click="saveRepy"
              v-show="!justShowOnlineSheet"
              >保存当前方案</el-button
            >
            <el-button
              type="primary"
              @click="saveRepyAll"
              v-if="
                onlineInquiryReplyData.index > 1 &&
                  !justAddOneReply &&
                  !justShowOnlineSheet
              "
              >保存全部</el-button
            >
          </el-button-group>
        </el-form-item>
      </el-form>
    </el-card>
    <el-dialog title="" :visible.sync="dialogTableVisible">
      <template v-if="customerChannelId != 0">
        <ChannelPrice
          v-bind:customerChannelId="`${customerChannelId}`"
          v-bind:justShowPrice="1"
        ></ChannelPrice>
      </template>
    </el-dialog>
  </div>
</template>
<script>
import { ajax } from "@/store/yg/common/utils";
import { m } from "@/store/yg/common/local";
import { clone } from "@/utils/clone";
import ChannelPrice from "@/components/app/edit/setting/channel/channelEdit";
export default {
  props: {
    onlineInquiryReplys: {
      type: Array,
      default: function() {
        return [];
      }
    },
    onlineInquiryReplyParent: {
      type: Object,
      default: function() {
        return {};
      }
    },
    onlineInquirySheetSimpleData: {
      type: Object,
      default: function() {
        return {};
      }
    },
    templateIndex: {
      type: Number,
      default: 0
    }
  },
  components: {
    ChannelPrice
  },
  data() {
    return {
      customerChannelId: 0,
      pickerBeginDateBefore: {
        disabledDate: this.disabledDate
      },
      onlineInquiryReplyData: {
        id: null,
        onlineInquirySheetId: null,
        waybillNos: null,
        index: 1,
        isAccept: 1,
        channelId: null,
        suggestPrice: null,
        validityDate: null,
        predictLeavePortDate: null,
        predictArrivalPortDate: null,
        remark: null,
        operateRemark: null,
        isQuotationList: 1,
        totalOnlineInquiryCost: null,
        avgOnlineInquiryCost: null,
        costUnit: null,
        forceUpdate: 0,
        version: 1,
        inquiryPrice: null,
        currency: null,
        onlineInquiryCosts: [],
        selectLettercurrent: null
      },
      onlineInquiryReplyRules: {
        isAccept: [
          {
            required: true,
            message: "是否可接不能为空"
          }
        ],
        channelId: [
          {
            required: true,
            message: "回复渠道不能为空"
          }
        ],
        validityDate: [
          {
            required: true,
            message: "请选择有效期"
          }
        ]
      },
      channelNameMap: {},
      amoebaSubjectMap: {},
      chargingTypeMap: {},
      isAcceptOptions: [
        { label: "可接", value: 1 },
        { label: "不可接", value: 0 }
      ],
      isQuotationListOptions: [
        { label: "是", value: 1 },
        { label: "否", value: 0 }
      ],
      totalReplySize: this.onlineInquiryReplys.length,
      justAddOneReply: false,
      justShowOnlineSheet: false,
      dialogTableVisible: false,
      tableInfo: null,
      loadPortAddress: [],
      initCustomerChannelData: [],
      countrys: [],
      countryStates: [],
      sortList: [],
      showTinymce: false,
      messageStr: ""
    };
  },

  watch: {
    onlineInquiryReplys: {
      handler(nVal) {
        this.totalReplySize = this.onlineInquiryReplys.length;
      }
    }
    // onlineInquiryReplyParent: {
    //   handler(val, oVal) {
    //     console.log('onlineInquiryReplyParent',val)
    //     for (let key in this.onlineInquiryReplyData) {
    //       const value = val[key];
    //       if (value && this.onlineInquiryReplyData[key] ===value) {
    //         this.onlineInquiryReplyData[key] = value;
    //       }
    //     }
    //   },
    //   deep:true,
    //   immediate: true,
    // }
  },
  mounted() {
    for (let key in this.onlineInquiryReplyData) {
      const value = this.onlineInquiryReplyParent[key];
      if (value) {
        this.onlineInquiryReplyData[key] = value;
      }
    }
    this.channelNameMap = this.onlineInquirySheetSimpleData.channelNameMap;

    this.amoebaSubjectMap = this.onlineInquirySheetSimpleData.amoebaSubjectMap;
    this.chargingTypeMap = this.onlineInquirySheetSimpleData.chargingTypeMap;
    if (this.onlineInquirySheetSimpleData.defaultChannelId) {
      if (!this.onlineInquiryReplyData.id) {
        this.onlineInquiryReplyData.channelId = this.onlineInquirySheetSimpleData.defaultChannelId;
      }
    }
    if (this.onlineInquirySheetSimpleData.justAddOneReply) {
      this.justAddOneReply = this.onlineInquirySheetSimpleData.justAddOneReply;
    }
    if (this.onlineInquirySheetSimpleData.justShowOnlineSheet) {
      this.justShowOnlineSheet = this.onlineInquirySheetSimpleData.justShowOnlineSheet;
    }
    if (this.chargingTypeMap) {
      let defaultCharge = this.onlineInquirySheetSimpleData.defaultChargingMode;
      if (!defaultCharge) {
        defaultCharge = parseInt(Object.keys(this.chargingTypeMap)[0]);
      }
      for (const i in this.onlineInquiryReplyData.onlineInquiryCosts) {
        const onlineInquiryCost = this.onlineInquiryReplyData
          .onlineInquiryCosts[i];

        this.onlineInquiryReplyData;
        if (!onlineInquiryCost.calculationMode) {
          onlineInquiryCost.calculationMode = defaultCharge;
        }
      }
    }
  },
  methods: {
    async init() {},
    disabledDate(time) {
      return time.getTime() < Date.now() - 8.64e7; //如果当天不可选，就不用减8.64e7
    },
    changeAmoebaSubjectMoney() {
      let totalMoney = 0;
      let avgMoney = 0;
      let costUnit = "票";
      let channelId = this.onlineInquiryReplyData.channelId;
      for (let i in this.onlineInquiryReplyData.onlineInquiryCosts) {
        const onlineInquiryCost = this.onlineInquiryReplyData
          .onlineInquiryCosts[i];
        if (onlineInquiryCost.unitPrice && onlineInquiryCost.calculationMode) {
          let unitPrice = parseFloat(onlineInquiryCost.unitPrice);
          let count = parseFloat(
            this.chargingTypeMap[onlineInquiryCost.calculationMode].split(
              " "
            )[0]
          );
          let money = Math.round(unitPrice * count * 100) / 100;
          onlineInquiryCost.money = money;
          totalMoney += money;
        } else {
          onlineInquiryCost.money = null;
        }
      }
      //计算平均价
      let onlineInquiryShippingWay = this.onlineInquirySheetSimpleData
        .onlineInquiryShippingWay;
      if (onlineInquiryShippingWay == 4 || onlineInquiryShippingWay == 5) {
        costUnit = "KG";
        let chargeWeight = this.onlineInquirySheetSimpleData.chargeWeight;
        if (chargeWeight) {
          avgMoney = totalMoney / chargeWeight;
        }
      } else if (channelId) {
        //根据渠道ID找到物流方法,FCL按票结算，LCL要根据渠道对应的规则才行
        const channelShippingWayMap = this.onlineInquirySheetSimpleData
          .channelShippingWayMap;
        if (channelShippingWayMap) {
          let channelShipping = channelShippingWayMap[channelId];
          if (channelShipping) {
            if (channelShipping == "FCL") {
              avgMoney = totalMoney;
            } else {
              const channelIdAndChargingModeMap = this
                .onlineInquirySheetSimpleData.channelIdAndChargingModeMap;
              if (channelIdAndChargingModeMap) {
                let chargeMode = channelIdAndChargingModeMap[channelId];
                if (chargeMode) {
                  let count = 0;
                  if (chargeMode == 0) {
                    count = this.onlineInquirySheetSimpleData
                      .customerActualWeight;
                    costUnit = "KG";
                  } else if (chargeMode == 1) {
                    count = this.onlineInquirySheetSimpleData.customerVolume;
                    costUnit = "CBM";
                  } else if (chargeMode == 2) {
                    count = this.onlineInquirySheetSimpleData.chargeWeight;
                    costUnit = "KG";
                  }
                  if (count != 0) {
                    avgMoney = totalMoney / count;
                  }
                }
              }
            }
          }
        }
      } else {
        avgMoney = totalMoney;
      }
      avgMoney = Math.round(avgMoney * 100) / 100;
      this.$delete(this.onlineInquiryReplyData, "totalOnlineInquiryCost");
      this.$delete(this.onlineInquiryReplyData, "avgOnlineInquiryCost");
      this.$delete(this.onlineInquiryReplyData, "costUnit");
      this.$nextTick(() => {
        this.$set(
          this.onlineInquiryReplyData,
          "totalOnlineInquiryCost",
          totalMoney
        );
        this.$set(
          this.onlineInquiryReplyData,
          "avgOnlineInquiryCost",
          avgMoney
        );
        this.$set(this.onlineInquiryReplyData, "costUnit", "RMB/" + costUnit);
      });
      // this.onlineInquiryReplyData.totalOnlineInquiryCost = totalMoney;
      // this.onlineInquiryReplyData.avgOnlineInquiryCost = avgMoney;
      // this.onlineInquiryReplyData.costUnit = "RMB/" + costUnit;
      // console.log(this.onlineInquiryReplyData.totalOnlineInquiryCost);
    },
    copyRepy() {
      // if (!this.onlineInquiryReplyData.id) {
      //   this.$message.error("请先保存当前方案");
      //   return;
      // }
      const newArr = [...clone(this.onlineInquiryReplys)];
      let replysLength = newArr.length;
      if (replysLength >= 3) {
        this.$message.error("方案已有" + replysLength + "个，不允许再添加");
        return;
      }
      replysLength++;
      const newReply = JSON.parse(JSON.stringify(this.onlineInquiryReplyData));
      newReply.id = null;
      newReply.index = replysLength;
      newArr.push(newReply);
      console.log("newArr", newArr);
      this.$emit("update:onlineInquiryReplys", newArr);
    },
    addEnptyRepy() {
      // if (!this.onlineInquiryReplyData.id) {
      //   this.$message.error("请先保存当前方案");
      //   return;
      // }
      const newArr = [...this.onlineInquiryReplys];
      let replysLength = newArr.length;
      if (replysLength >= 3) {
        this.$message.error("方案已有" + replysLength + "个，不允许再添加");
        return;
      }
      replysLength++;
      const newReply = JSON.parse(JSON.stringify(this.onlineInquiryReplyData));

      newReply.id = null;
      newReply.index = replysLength;
      const copyCosts = JSON.parse(
        JSON.stringify(this.onlineInquiryReplyData.onlineInquiryCosts)
      );
      newArr.push({
        id: null,
        onlineInquirySheetId: newReply.onlineInquirySheetId,
        waybillNos: null,
        inquiryPrice: null,
        currency: null,
        index: replysLength,
        isAccept: 1,
        channelId: null,
        suggestPrice: null,
        validityDate: null,
        predictLeavePortDate: null,
        predictArrivalPortDate: null,
        remark: null,
        operateRemark: null,
        isQuotationList: 1,
        totalOnlineInquiryCost: null,
        avgOnlineInquiryCost: null,
        costUnit: null,
        forceUpdate: 0,
        version: 1,
        onlineInquiryCosts: copyCosts
      });
      this.$emit("update:onlineInquiryReplys", newArr);
    },
    deleteRepy() {
      this.$confirm("确认要删除？")
        .then(_ => {
          let replyId = this.onlineInquiryReplyData.id;
          if (replyId) {
            //ajax删除后台
            const params = {};
            params.id = replyId;
            params.onlineInquirySheetId = this.onlineInquiryReplyData.onlineInquirySheetId;
            ajax("deleteOnlineInquiryReply", params).then(
              res => {
                if (res.code == 200) {
                  this.deleteReplyVue();
                } else {
                  this.$message.error(m(res.message));
                }
              },
              error => {
                this.$message.error(error);
              }
            );
          } else {
            this.deleteReplyVue();
          }
        })
        .catch(_ => {});
    },
    saveRepyAll() {
      this.$refs["onlineInquiryReplyForm"].validate(valid => {
        if (!valid) return;
        this.$emit("saveAll");
      });
    },
    saveRepy() {
      const copyCosts = JSON.parse(
        JSON.stringify(this.onlineInquiryReplyData.onlineInquiryCosts)
      );
      const newArr = [...this.onlineInquiryReplys];
      console.log(newArr);
      this.$refs["onlineInquiryReplyForm"].validate(valid => {
        if (!valid) return;
        const params = this.onlineInquiryReplyData;
        console.log(this.onlineInquiryReplyData);
        this.saveOrUpdateOnlineInquiryReply(params);
      });
    },
    deleteReplyVue() {
      let index = this.onlineInquiryReplyData.index;
      const arr = [...this.onlineInquiryReplys];
      arr.splice(
        arr.findIndex(item => item.index === index),
        1
      );
      if (arr.length == 2 && index == 2) {
        arr[arr.length - 1].index = 2;
      }
      this.$emit("update:onlineInquiryReplys", arr);
    },
    m(params) {
      return m(params);
    },

    async saveOrUpdateOnlineInquiryReply(params) {
      const data = await ajax("saveOrUpdateOnlineInquiryReply", params);
      if (data.code == 200) {
        this.$message.success("操作成功");
        this.onlineInquiryReplyData.id = data.data;
        if (data.data4) {
          this.$message.error(data.data4);
        }
        if (data.data3) {
          this.messageStr = data.data3;
        }
        //window.open(`#/main/waybill__onlineinquiry__list`)
      } else if (data.code == 300) {
        this.$confirm(m(data.message), "警告", {
          confirmButtonText: "强制保存",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(_ => {
            params["forceUpdate"] = 1;
            this.saveOrUpdateOnlineInquiryReply(params);
          })
          .catch(_ => {});
      } else {
        this.$message.error(m(data.message));
      }
    },

    selectLetterClick(selVal) {
      // this.selectLettercurrent=selVal;
      // const attrs = {
      //   class: 'com.tofba.app.client.seaair.CustomerChannelClient'
      // }
      // this.initCustomerChannelData = ajax("initCustomerChannelData", {},attrs);
      // this.loadPortAddress = this.initCustomerChannelData.loadPortAddress;
      // this.countrys = this.initCustomerChannelData.countrys;
      // this.countryStates = this.initCustomerChannelData.countryStates;

      this.customerChannelId = selVal;
    },

    dialogTableVisibleClick() {
      this.dialogTableVisible = true;
      this.customerChannelId = this.onlineInquiryReplyData.channelId;
      console.log(this.customerChannelId);

      // console.log("selectLettercurrent", this.selectLettercurrent);
      // this.dialogTableVisible=true;
      // ajax("queryChannelById", {
      //   customerChannelId: this.selectLettercurrent,
      //   consignmentPlaceId: null
      // },{})
      //   .then(res => {
      //     this.tableInfo = res;
      //
      //     if (
      //       res.relateId &&
      //       res.customerChannel.channelSubareaIds[res.relateId]
      //     ) {
      //       this.sortList = res.customerChannel.channelSubareaIds[res.relateId];
      //     }
      //     if (
      //       res &&
      //       res.channelUseTimes &&
      //       res.channelUseTimes.length > 0
      //     ) {
      //       this.timeActiveName = res.channelUseTimes[0].id.toString();
      //     }
      //
      //     if (
      //       res &&
      //       res.channelLoadingPorts &&
      //       res.channelLoadingPorts.length > 0
      //     ) {
      //       this.activeName = res.channelLoadingPorts[0].consignmentPlaceId.toString();
      //     }
      //   })
    },
    handleUserTimeClick(tab) {
      const attrs = {
        class: "com.tofba.app.client.seaair.AmoebaCustomerChannelClient"
      };
      ajax(
        "queryAmoebaChannelById",
        {
          customerChannelId: this.selectLettercurrent,
          relateId: parseInt(tab.name)
        },
        attrs
      )
        .then(res => {
          this.tableInfo = res;
          if (
            res &&
            res.channelLoadingPorts &&
            res.channelLoadingPorts.length > 0
          ) {
            this.activeName = res.channelLoadingPorts[0].consignmentPlaceId.toString();
          }
          if (
            res.relateId &&
            res.customerChannel.channelSubareaIds[res.relateId]
          ) {
            this.sortList = res.customerChannel.channelSubareaIds[res.relateId];
          }
        })
        .catch(error => {
          console.log(error);
        });
    },
    handleClick(tab) {
      const attrs = {
        class: "com.tofba.app.client.seaair.AmoebaCustomerChannelClient"
      };
      ajax(
        "queryAmoebaChannelById",
        {
          customerChannelId: this.selectLettercurrent,
          consignmentPlaceId: parseInt(tab.name),
          relateId: parseInt(this.timeActiveName)
        },
        attrs
      )
        .then(res => {
          this.tableInfo = res;
        })
        .catch(error => {
          console.log(error);
        });
    }
  }
};
</script>
<style scoped>
.p_ms {
  line-height: 30px;
  margin-left: 28px;
}
</style>
